import Vue from 'vue'
import Vuex from 'vuex'
import { getList } from "@/api/index.js"

interface listType {
  data: any[],
  code: number
}
Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    list: [],
  },
  mutations: {
    SET_LIST(state, payload) {
      state.list = payload
    }
  },
  actions: {
    getLIST({ commit }) {
      getList().then((res: listType) => {
        commit("SET_LIST", res.data)
      })
    }
  },
  modules: {
  }
})
